package com.juqimiao.raccoon.commodity.messaging.impl;

import com.juqimiao.linn.domain.DomainEventI;
import com.juqimiao.linn.domain.DomainServiceI;
import com.juqimiao.linn.event.EventBus;
import com.juqimiao.raccoon.commodity.messaging.DomainEventServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Todo: Think it over.
 */
@Component
public class DomainEventService implements DomainEventServiceI {

    private EventBus eventBus;

    @Autowired
    public DomainEventService(EventBus eventBus) {
        this.eventBus = eventBus;
    }

    @Override
    public void publish(DomainEventI domainEvent) {
        eventBus.post(domainEvent);
    }
}
